package com.laxcen.smoke.util;

import com.laxcen.smoke.config.CommonEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

@ApiModel
public class Response<T> {

    @ApiModelProperty(value = "返回码：正确0  错误为自定义码")
    private int error;//错误码
    @ApiModelProperty(value = "返回消息")
    private String msg;//错误信息
    @ApiModelProperty(value = "返回具体内容")
    private T data;//信息内容

    public Response(){

    }

    public Response(CommonEnum commonEnum) {
        error = commonEnum.getError();
        msg = commonEnum.getMsg();
    }


    public int getError() {
        return error;
    }

    public void setError(int error) {
        this.error = error;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public void setErr(int error, String msg) {
        this.error = error;
        this.msg = msg;
    }

    public void setOK() {
        this.error = 200;
        this.msg = "成功";
    }


}
